﻿package mortal.game.view.autoFight
{
    import Message.BroadCast.*;
    import Message.Game.*;
    import Message.Public.*;
    import __AS3__.vec.*;
    import extend.language.*;
    import fl.data.*;
    import flash.geom.*;
    import flash.utils.*;
    import mortal.component.gconst.*;
    import mortal.game.*;
    import mortal.game.cache.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.scene3D.layer3D.utils.*;
    import mortal.game.scene3D.map3D.AstarAnyDirection.data.*;
    import mortal.game.scene3D.map3D.sceneInfo.*;
    import mortal.game.scene3D.map3D.util.*;
    import mortal.game.scene3D.player.entity.*;
    import mortal.game.scene3D.util.*;
    import mortal.game.utils.*;
    import mortal.game.view.autoFight.data.*;
    import mortal.game.view.common.cd.*;
    import mortal.game.view.copy.petBreak.*;
    import mortal.game.view.skill.*;
    import mortal.game.view.systemSetting.*;
    import mortal.game.view.task.data.*;
    import mortal.game.view.wizard.data.*;
    import mortal.mvc.core.*;

    public class AutoFightCache extends Object
    {
        private var _bossNotSelect:Dictionary;
        private var _skillDatas:Dictionary;
        private var _skillDatas2:Dictionary;
        private var _curBossPointIndex:int = 0;
        private var _lastMapId:int = -1;
        private var _bossPoints:Array;
        private var _bossPointsKilled:Array;
        private var _hasWalkedTo:Array;
        private var bossRect:Rectangle;

        public function AutoFightCache()
        {
            this._bossNotSelect = new Dictionary();
            this._skillDatas = new Dictionary();
            this._skillDatas2 = new Dictionary();
            this.bossRect = new Rectangle();
            return;
        }// end function

        public function setBossNotSelect(param1:int, param2:Boolean) : void
        {
            this._bossNotSelect[param1] = param2;
            return;
        }// end function

        public function resetBossNotSelect() : void
        {
            this._bossNotSelect = new Dictionary();
            return;
        }// end function

        public function isBossSelected(param1:int) : Boolean
        {
            return !this._bossNotSelect[param1];
        }// end function

        public function setToNextBossRefreshPoint(param1:Boolean = false) : void
        {
            var _loc_2:String = this;
            var _loc_3:* = this._curBossPointIndex + 1;
            _loc_2._curBossPointIndex = _loc_3;
            if (param1)
            {
                if (this._bossPoints != null && this._curBossPointIndex >= this._bossPoints.length)
                {
                    this._curBossPointIndex = this._bossPoints.length - 1;
                }
                return;
            }
            return;
        }// end function

        public function getCurBossRereshPoint() : Point
        {
            if (Game.mapInfo.mapId != this._lastMapId)
            {
                this._lastMapId = Game.mapInfo.mapId;
                this.updateToCurMapBossPoints();
            }
            if (this._curBossPointIndex >= this._bossPoints.length)
            {
                this._curBossPointIndex = 0;
            }
            return this._bossPoints[this._curBossPointIndex];
        }// end function

        public function isLastBossRefreshPoint() : Boolean
        {
            if (this._bossPoints == null || this._bossPoints.length < 1)
            {
                return true;
            }
            if (this._curBossPointIndex >= (this._bossPoints.length - 1))
            {
                return true;
            }
            return false;
        }// end function

        public function isBossPointKilled(param1:int, param2:int) : Boolean
        {
            var _loc_4:Point = null;
            if (this._bossPoints == null || this._bossPointsKilled == null)
            {
                return false;
            }
            var _loc_3:int = 0;
            while (_loc_3 < this._bossPoints.length)
            {
                
                _loc_4 = this._bossPoints[_loc_3];
                if (_loc_4.x == param1 && _loc_4.y == param2)
                {
                    return this._bossPointsKilled[_loc_3] as Boolean;
                }
                _loc_3++;
            }
            return false;
        }// end function

        public function updateBossKilled() : void
        {
            var _loc_6:Point = null;
            var _loc_7:Array = null;
            var _loc_8:Boolean = false;
            var _loc_9:IEntity = null;
            if (this._bossPoints == null && Game.mapInfo != null)
            {
                if (Game.mapInfo.mapId != this._lastMapId)
                {
                    this._lastMapId = Game.mapInfo.mapId;
                    this.updateToCurMapBossPoints();
                }
                if (this._bossPoints == null)
                {
                    return;
                }
            }
            var _loc_1:* = this._bossPointsKilled;
            this._bossPointsKilled = [];
            var _loc_2:Boolean = false;
            var _loc_3:int = -1;
            var _loc_4:* = Cache.instance.copy.isInCopy;
            var _loc_5:int = 0;
            while (_loc_5 < this._bossPoints.length)
            {
                
                _loc_6 = this._bossPoints[_loc_5];
                this.bossRect.x = _loc_6.x - 400;
                this.bossRect.y = _loc_6.y - 300;
                this.bossRect.width = 800;
                this.bossRect.height = 600;
                _loc_7 = ThingUtil.entityUtil.entitysMap.getEntityByRangle(this.bossRect, EEntityType._EEntityTypeBoss);
                if (_loc_7.length > 0)
                {
                    _loc_8 = false;
                    for each (_loc_9 in _loc_7)
                    {
                        
                        if (FightUtil.isNormalAttackable(_loc_9))
                        {
                            this._bossPointsKilled[_loc_5] = false;
                            _loc_8 = true;
                            break;
                        }
                    }
                    if (!_loc_8)
                    {
                        this._bossPointsKilled[_loc_5] = true;
                    }
                }
                else
                {
                    this._bossPointsKilled[_loc_5] = true;
                }
                if (this._bossPointsKilled[_loc_5] == false && _loc_3 < 0)
                {
                    _loc_3 = _loc_5;
                    this._curBossPointIndex = _loc_5;
                }
                _loc_5++;
            }
            if ((_loc_1 == null || _loc_1.length == 0) && this._bossPointsKilled.length > 0)
            {
                _loc_2 = true;
            }
            else if (_loc_1 != null && _loc_1.length > 0)
            {
                _loc_5 = 0;
                while (_loc_5 < _loc_1.length)
                {
                    
                    if (this._bossPointsKilled[_loc_5] != _loc_1[_loc_5])
                    {
                        _loc_2 = true;
                        break;
                    }
                    _loc_5++;
                }
            }
            else
            {
                _loc_2 = true;
            }
            if (_loc_2)
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.SmallMapBossKilledUpdate));
            }
            return;
        }// end function

        public function resetToMinCanFightBossPoint() : void
        {
            var _loc_4:Point = null;
            var _loc_5:int = 0;
            var _loc_6:Array = null;
            var _loc_7:Boolean = false;
            var _loc_8:IEntity = null;
            if (this._bossPoints == null && Game.mapInfo != null)
            {
                if (Game.mapInfo.mapId != this._lastMapId)
                {
                    this._lastMapId = Game.mapInfo.mapId;
                    this.updateToCurMapBossPoints();
                }
                if (this._bossPoints == null)
                {
                    this._curBossPointIndex = 0;
                    return;
                }
            }
            var _loc_1:* = Cache.instance.copy.isInCopy;
            var _loc_2:int = -1;
            var _loc_3:int = 0;
            while (_loc_3 < this._bossPoints.length)
            {
                
                _loc_4 = this._bossPoints[_loc_3];
                _loc_5 = GeomUtil.calcDistance(_loc_4.x, _loc_4.y, RolePlayer.instance.x2d, RolePlayer.instance.y2d);
                this.bossRect.x = _loc_4.x - 500;
                this.bossRect.y = _loc_4.y - 400;
                this.bossRect.width = 1000;
                this.bossRect.height = 800;
                _loc_6 = ThingUtil.entityUtil.entitysMap.getEntityByRangle(this.bossRect, EEntityType._EEntityTypeBoss);
                if (_loc_6.length > 0)
                {
                    _loc_7 = false;
                    for each (_loc_8 in _loc_6)
                    {
                        
                        if (FightUtil.isNormalAttackable(_loc_8))
                        {
                            _loc_7 = true;
                            break;
                        }
                    }
                    if (_loc_7)
                    {
                        _loc_2 = _loc_3;
                        break;
                    }
                }
                _loc_3++;
            }
            if (_loc_2 < 0)
            {
                if (CopyUtil.isInCopy)
                {
                    _loc_2 = this._bossPoints.length - 1;
                }
                else
                {
                    _loc_2 = 0;
                }
            }
            this._curBossPointIndex = _loc_2;
            return;
        }// end function

        public function resetToNearestBossPoint(param1:Boolean = true) : void
        {
            var _loc_6:Point = null;
            var _loc_7:int = 0;
            var _loc_8:Array = null;
            var _loc_9:Boolean = false;
            var _loc_10:IEntity = null;
            if (this._bossPoints == null && Game.mapInfo != null)
            {
                if (Game.mapInfo.mapId != this._lastMapId)
                {
                    this._lastMapId = Game.mapInfo.mapId;
                    this.updateToCurMapBossPoints();
                }
                if (this._bossPoints == null)
                {
                    this._curBossPointIndex = 0;
                    return;
                }
            }
            var _loc_2:* = Cache.instance.copy.isInCopy;
            var _loc_3:* = int.MAX_VALUE;
            var _loc_4:int = -1;
            var _loc_5:int = 0;
            while (_loc_5 < this._bossPoints.length)
            {
                
                _loc_6 = this._bossPoints[_loc_5];
                _loc_7 = GeomUtil.calcDistance(_loc_6.x, _loc_6.y, RolePlayer.instance.x2d, RolePlayer.instance.y2d);
                if (_loc_7 < _loc_3)
                {
                    if (!_loc_2)
                    {
                        _loc_3 = _loc_7;
                        _loc_4 = _loc_5;
                    }
                    else
                    {
                        this.bossRect.x = _loc_6.x - 500;
                        this.bossRect.y = _loc_6.y - 400;
                        this.bossRect.width = 1000;
                        this.bossRect.height = 800;
                        _loc_8 = ThingUtil.entityUtil.entitysMap.getEntityByRangle(this.bossRect, EEntityType._EEntityTypeBoss);
                        if (!param1)
                        {
                            _loc_3 = _loc_7;
                            _loc_4 = _loc_5;
                        }
                        if (_loc_8.length > 0)
                        {
                            _loc_9 = false;
                            for each (_loc_10 in _loc_8)
                            {
                                
                                if (FightUtil.isNormalAttackable(_loc_10))
                                {
                                    _loc_9 = true;
                                    break;
                                }
                            }
                            if (_loc_9)
                            {
                                _loc_3 = _loc_7;
                                _loc_4 = _loc_5;
                            }
                        }
                    }
                }
                _loc_5++;
            }
            if (_loc_4 < 0)
            {
                if (CopyUtil.isInCopy)
                {
                    _loc_4 = this._bossPoints.length - 1;
                }
                else
                {
                    _loc_4 = 0;
                }
            }
            this._curBossPointIndex = _loc_4;
            return;
        }// end function

        public function resetBossPointIndex() : void
        {
            this._curBossPointIndex = 0;
            return;
        }// end function

        private function updateToCurMapBossPoints() : void
        {
            var _loc_4:BossRefreshInfo = null;
            var _loc_5:String = null;
            var _loc_6:Array = null;
            var _loc_7:int = 0;
            var _loc_1:* = SceneConfig.instance.getSceneInfo(this._lastMapId);
            if (_loc_1 == null)
            {
                return;
            }
            this._bossPoints = [];
            var _loc_2:* = _loc_1.bossRefreshs;
            if (_loc_2 == null || _loc_2.length == 0)
            {
                return;
            }
            _loc_2.sort(this.sortByPlan);
            var _loc_3:int = 0;
            while (_loc_3 < _loc_2.length)
            {
                
                _loc_4 = _loc_2[_loc_3] as BossRefreshInfo;
                this._bossPoints.push(new Point(_loc_4.x, _loc_4.y));
                _loc_5 = _loc_4.subPoints;
                if (_loc_5 != null && _loc_5.length > 0)
                {
                    _loc_6 = _loc_5.split(",");
                    _loc_7 = 0;
                    while (_loc_7 < _loc_6.length)
                    {
                        
                        this._bossPoints.push(new Point(_loc_4.x + int(_loc_6[_loc_7]), _loc_4.y + int(_loc_6[(_loc_7 + 1)])));
                        _loc_7 = _loc_7 + 2;
                    }
                }
                _loc_3++;
            }
            return;
        }// end function

        private function sortByPlan(param1:BossRefreshInfo, param2:BossRefreshInfo) : int
        {
            if (param1.plan > param2.plan)
            {
                return 1;
            }
            if (param1.plan == param2.plan)
            {
                return 0;
            }
            return -1;
        }// end function

        public function getBossList(param1:int, param2:Boolean = false) : DataProvider
        {
            var _loc_7:BossRefreshInfo = null;
            var _loc_8:Array = null;
            var _loc_9:int = 0;
            var _loc_10:SelectBossData = null;
            var _loc_3:* = new DataProvider();
            var _loc_4:* = SceneConfig.instance.getSceneInfo(param1);
            if (_loc_4 == null)
            {
                return _loc_3;
            }
            var _loc_5:* = _loc_4.bossRefreshs;
            var _loc_6:int = 0;
            while (_loc_6 < _loc_5.length)
            {
                
                _loc_7 = _loc_5[_loc_6] as BossRefreshInfo;
                _loc_8 = _loc_7.bosses;
                _loc_9 = 0;
                while (_loc_9 < _loc_8.length)
                {
                    
                    _loc_10 = new SelectBossData();
                    _loc_10.boss = _loc_8[_loc_9];
                    if (!param2)
                    {
                        _loc_10.selected = !this._bossNotSelect[_loc_10.boss.code];
                    }
                    else
                    {
                        _loc_10.selected = true;
                    }
                    _loc_3.addItem(_loc_10);
                    _loc_9++;
                }
                _loc_6++;
            }
            return _loc_3;
        }// end function

        public function getMainSkillData(param1:int = 0, param2:Boolean = false, param3:Boolean = true) : DataProvider
        {
            var _loc_9:SkillInfo = null;
            var _loc_10:AFSkillData = null;
            var _loc_4:* = Cache.instance.skill.getAllCareerSkills();
            var _loc_5:* = new DataProvider();
            var _loc_6:* = IsDoneType.AutoFightSkillActiveStart;
            var _loc_7:* = this._skillDatas;
            if (param1 == AFSkillPlanIndex.plan2)
            {
                _loc_6 = IsDoneType.AutoFightSkillActiveStart2;
                _loc_7 = this._skillDatas2;
            }
            var _loc_8:int = 0;
            while (_loc_8 < _loc_4.length)
            {
                
                _loc_9 = _loc_4[_loc_8];
                if (_loc_9 == null || !_loc_9.learned)
                {
                }
                else if (_loc_9.tSkill.hookType == SkillHookType.attack)
                {
                    if (!param3 && _loc_7[_loc_9.position] != null)
                    {
                        _loc_5.addItem(_loc_7[_loc_9.position]);
                    }
                    else
                    {
                        _loc_10 = new AFSkillData();
                        _loc_10.info = _loc_9;
                        if (!param2)
                        {
                            _loc_10.isActive = !ClientSetting.local.getIsDone(_loc_9.position + _loc_6 - 1);
                        }
                        else
                        {
                            _loc_10.isActive = true;
                        }
                        _loc_10.value = -1;
                        _loc_7[_loc_9.position] = _loc_10;
                        _loc_5.addItem(_loc_10);
                    }
                }
                _loc_8++;
            }
            return _loc_5;
        }// end function

        public function getWizardSkills() : Array
        {
            var _loc_4:int = 0;
            var _loc_5:WizardData = null;
            var _loc_6:AFSkillData = null;
            var _loc_7:int = 0;
            var _loc_1:Array = [];
            if (Cache.instance.role.roleInfo.level < GameConst.AutoUseWizardSkillMinLv)
            {
                return _loc_1;
            }
            var _loc_2:* = Cache.instance.wizard.soulList;
            var _loc_3:* = Cache.instance.wizard.fightWizardCode;
            if (_loc_2 != null)
            {
                _loc_4 = 0;
                while (_loc_4 < _loc_2.length)
                {
                    
                    _loc_5 = _loc_2[_loc_4];
                    if (!_loc_5.isHasWizard)
                    {
                    }
                    else if (_loc_5.code != _loc_3)
                    {
                    }
                    else
                    {
                        _loc_6 = new AFSkillData();
                        _loc_7 = _loc_5.tSpriteEx.xpskillId;
                        _loc_6.info = new SkillInfo();
                        _loc_6.info.learned = true;
                        _loc_6.info.tSkill = SkillConfig.instance.getInfoById(_loc_7);
                        _loc_6.isActive = true;
                        _loc_1.push(_loc_6);
                    }
                    _loc_4++;
                }
            }
            return _loc_1;
        }// end function

        public function getAssistSkillData(param1:Boolean = false) : Array
        {
            var _loc_7:SkillInfo = null;
            var _loc_8:AFSkillData = null;
            var _loc_2:* = Cache.instance.skill.getAllCareerSkills();
            var _loc_3:Array = [];
            var _loc_4:* = ClientSetting.local.AFAssistSkillValues;
            var _loc_5:* = IsDoneType.AutoFightSkillActiveStart;
            var _loc_6:int = 0;
            while (_loc_6 < _loc_2.length)
            {
                
                _loc_7 = _loc_2[_loc_6];
                if (_loc_7 == null || !_loc_7.learned)
                {
                }
                else if (_loc_7.tSkill.hookType == SkillHookType.buff || _loc_7.tSkill.hookType == SkillHookType.life || _loc_7.tSkill.hookType == SkillHookType.mana)
                {
                    _loc_8 = new AFSkillData();
                    _loc_8.info = _loc_7;
                    if (!param1)
                    {
                        _loc_8.isActive = !ClientSetting.local.getIsDone(_loc_7.position + _loc_5 - 1);
                    }
                    else
                    {
                        _loc_8.isActive = true;
                    }
                    _loc_8.value = _loc_4[(_loc_7.position - 1)];
                    this.getHookName(_loc_7.tSkill.hookType, _loc_8);
                    this._skillDatas[_loc_7.position] = _loc_8;
                    _loc_3.push(_loc_8);
                }
                _loc_6++;
            }
            return _loc_3;
        }// end function

        private function getHookName(param1:int, param2:AFSkillData) : void
        {
            var _loc_3:String = "";
            switch(param1)
            {
                case SkillHookType.life:
                {
                    param2.titleName = Language.getString(20178);
                    param2.strUse = Language.getString(21252);
                    break;
                }
                case SkillHookType.mana:
                {
                    param2.titleName = Language.getString(20179);
                    param2.strUse = Language.getString(21252);
                    break;
                }
                case SkillHookType.buff:
                {
                    param2.titleName = Language.getString(20180);
                    param2.strUse = Language.getString(21253);
                    break;
                }
                default:
                {
                    param2.titleName = Language.getString(20179);
                    param2.strUse = Language.getString(21252);
                    break;
                    break;
                }
            }
            return;
        }// end function

        public function saveCacheDatas() : Boolean
        {
            var _loc_3:int = 0;
            var _loc_4:AFSkillData = null;
            var _loc_1:Boolean = false;
            var _loc_2:* = IsDoneType.AutoFightSkillActiveStart;
            for each (_loc_4 in this._skillDatas)
            {
                
                if (_loc_4 == null)
                {
                    continue;
                }
                _loc_3 = _loc_4.info.position + _loc_2 - 1;
                if (_loc_4.isActive == ClientSetting.local.getIsDone(_loc_3))
                {
                    _loc_1 = true;
                    ClientSetting.local.setIsDone(!_loc_4.isActive, _loc_3);
                }
                _loc_3 = _loc_4.info.position - 1;
                if ((_loc_4.info.tSkill.hookType == SkillHookType.life || _loc_4.info.tSkill.hookType == SkillHookType.mana) && ClientSetting.local.AFAssistSkillValues[_loc_3] != _loc_4.value)
                {
                    _loc_1 = true;
                    ClientSetting.local.AFAssistSkillValues[_loc_3] = _loc_4.value;
                    ClientSetting.isChanged = true;
                }
            }
            _loc_2 = IsDoneType.AutoFightSkillActiveStart2;
            for each (_loc_4 in this._skillDatas2)
            {
                
                if (_loc_4 == null)
                {
                    continue;
                }
                _loc_3 = _loc_4.info.position + _loc_2 - 1;
                if (_loc_4.isActive == ClientSetting.local.getIsDone(_loc_3))
                {
                    _loc_1 = true;
                    ClientSetting.local.setIsDone(!_loc_4.isActive, _loc_3);
                    ClientSetting.isChanged = true;
                }
            }
            return _loc_1;
        }// end function

        public function getCanUseSkill(param1:Boolean = false) : SkillInfo
        {
            var _loc_6:SkillInfo = null;
            var _loc_7:SkillInfo = null;
            var _loc_8:Array = null;
            var _loc_10:SkillInfo = null;
            var _loc_11:ICDData = null;
            var _loc_12:Boolean = false;
            var _loc_13:int = 0;
            var _loc_14:int = 0;
            var _loc_2:* = Cache.instance.role.roleEntityInfo.entityInfo;
            var _loc_3:* = IsDoneType.AutoFightSkillActiveStart;
            var _loc_4:* = ClientSetting.local.getIsDone(IsDoneType.UseMainSkill);
            var _loc_5:* = ClientSetting.local.getIsDone(IsDoneType.UseAssistSkill);
            if (ClientSetting.local.getIsDone(IsDoneType.UseSecondSkillPlan))
            {
                _loc_3 = IsDoneType.AutoFightSkillActiveStart2;
            }
            var _loc_9:int = 0;
            if (Cache.instance.skill.isShowingExSkill)
            {
                param1 = false;
                _loc_8 = Cache.instance.skill.getExSkillList();
                _loc_9 = _loc_8.length;
            }
            else
            {
                _loc_8 = Cache.instance.skill.getAllSkillsLearned();
            }
            for each (_loc_10 in _loc_8)
            {
                
                if (_loc_9 > 0)
                {
                    _loc_10 = Cache.instance.skill.getExtSkillByPosType(_loc_9);
                    _loc_9 = _loc_9 - 1;
                }
                if (_loc_10 == null)
                {
                    continue;
                }
                if (_loc_10.tSkill.consume > _loc_2.mana)
                {
                    continue;
                }
                _loc_11 = Cache.instance.cd.getCDData(_loc_10, CDDataType.skillInfo);
                if (_loc_11 && _loc_11.isCoolDown)
                {
                    continue;
                }
                if (!BuffUtil.isCanRoleFireSkill(_loc_10))
                {
                    continue;
                }
                if (_loc_10.tSkill.hookType == SkillHookType.attack)
                {
                    if (_loc_10.isComboSkill)
                    {
                        _loc_7 = _loc_10;
                    }
                }
                _loc_12 = !ClientSetting.local.getIsDone(_loc_3 + _loc_10.position - 1);
                if (!_loc_12)
                {
                    continue;
                }
                if (param1)
                {
                    if (_loc_10.isComboSkill)
                    {
                        return _loc_10;
                    }
                    continue;
                }
                if (!RolePlayer.instance.entityInfo.fighting)
                {
                    if (SkillUtil.isToSelfSkill(_loc_10))
                    {
                        continue;
                    }
                }
                _loc_13 = ClientSetting.local.AFAssistSkillValues[(_loc_10.position - 1)];
                if (_loc_13 == 0)
                {
                    _loc_13 = 100;
                }
                if (_loc_10.tSkill.hookType == SkillHookType.attack)
                {
                    if (_loc_10.isComboSkill)
                    {
                        _loc_7 = _loc_10;
                    }
                    else
                    {
                        return _loc_10;
                    }
                    continue;
                }
                if (_loc_10.tSkill.hookType == SkillHookType.life)
                {
                    _loc_14 = _loc_2.life / _loc_2.maxLife * 100;
                    if (_loc_14 <= _loc_13)
                    {
                        return _loc_10;
                    }
                    continue;
                }
                if (_loc_10.tSkill.hookType == SkillHookType.mana)
                {
                    _loc_14 = _loc_2.mana / _loc_2.maxMana * 100;
                    if (_loc_14 <= _loc_13)
                    {
                        return _loc_10;
                    }
                    continue;
                }
                if (_loc_10.tSkill.hookType == SkillHookType.buff)
                {
                    if (Cache.instance.buff.getBuffById(_loc_10.tSkill.additionBuff) == null)
                    {
                        _loc_6 = _loc_10;
                    }
                }
            }
            if (_loc_6 == null)
            {
                return _loc_7;
            }
            return _loc_6;
        }// end function

        public function getCanUsePetSkill() : SkillInfo
        {
            var _loc_4:SkillInfo = null;
            var _loc_5:SkillInfo = null;
            var _loc_6:ICDData = null;
            var _loc_1:* = Cache.instance.copy.petBreakCopy.entityInfo;
            var _loc_2:* = Cache.instance.skill.getExSkillList();
            var _loc_3:* = SSkill(PetBreakCopyUtil.baseSkill[0]).skillId;
            for each (_loc_5 in _loc_2)
            {
                
                if (_loc_5 == null)
                {
                    continue;
                }
                if (_loc_5.tSkill.consume > _loc_1.mana)
                {
                    continue;
                }
                _loc_6 = Cache.instance.cd.getCDData(_loc_5, CDDataType.skillInfo);
                if (_loc_6 && _loc_6.isCoolDown)
                {
                    continue;
                }
                if (_loc_5.tSkill.skillId == _loc_3)
                {
                    _loc_4 = _loc_5;
                    continue;
                }
                if (_loc_5.tSkill.triggerType == 0)
                {
                    return _loc_5;
                }
            }
            return _loc_4;
        }// end function

        public function getCanFightBoss(param1:int = -1) : IEntity
        {
            var _loc_2:SEntityInfo = null;
            if (ThingUtil.selectEntity != null && ThingUtil.selectEntity.entityInfo != null && !ThingUtil.selectEntity.entityInfo.isDead)
            {
                _loc_2 = ThingUtil.selectEntity.entityInfo.entityInfo;
                if (!EntityRelationUtil.isFriend(_loc_2))
                {
                    return ThingUtil.selectEntity;
                }
            }
            return null;
        }// end function

        public function get isAutoRelieve() : Boolean
        {
            return ClientSetting.local.getIsDone(IsDoneType.AutoRelieve);
        }// end function

        public function get isAutoBuyPropForRelieve() : Boolean
        {
            return ClientSetting.local.getIsDone(IsDoneType.AutoBuy);
        }// end function

        public function get isAutoBuyCXDrug() : Boolean
        {
            return !ClientSetting.local.getIsDone(IsDoneType.AutoBuyCX);
        }// end function

        public function get isAutoAcceptTeam() : Boolean
        {
            return !ClientSetting.local.getIsDone(IsDoneType.AutoAcceptTeam);
        }// end function

        public function get isCurMapCanAutoFight() : Boolean
        {
            if (GameMapUtil.curMapState.isArenaCopy || GameMapUtil.curMapState.isHeroArenaMap)
            {
                return false;
            }
            if (GameController.arena.isWatching || GameController.copy.heroArenaCopy.isWatching)
            {
                return false;
            }
            if (GameMapUtil.curMapState.isGuildWar)
            {
                return false;
            }
            return true;
        }// end function

        public function getPickUpEquipMinColor() : int
        {
            return ClientSetting.local.AutoFightQualityIndex;
        }// end function

        public function getPickUpEquipCareer() : int
        {
            var _loc_1:* = AutoFightModule.boxCareerData;
            var _loc_2:* = ClientSetting.local.AutoFightCareerIndex;
            var _loc_3:* = _loc_1[_loc_2];
            if (_loc_3 == null)
            {
                return ECareer._ECareerNo;
            }
            return parseInt(_loc_3["name"]);
        }// end function

        public function getCurMapTaskBoss() : Dictionary
        {
            var _loc_3:TaskInfo = null;
            var _loc_4:int = 0;
            var _loc_5:Array = null;
            var _loc_6:int = 0;
            var _loc_7:SProcess = null;
            var _loc_8:int = 0;
            var _loc_1:* = new Dictionary();
            var _loc_2:* = Cache.instance.task.taskDoing;
            for each (_loc_3 in _loc_2)
            {
                
                _loc_4 = _loc_3.curStep;
                _loc_5 = _loc_3.stask.processMap[_loc_4];
                if (_loc_5 == null)
                {
                    continue;
                }
                _loc_6 = 0;
                while (_loc_6 < _loc_5.length)
                {
                    
                    _loc_7 = _loc_5[_loc_6] as SProcess;
                    if (_loc_7 == null)
                    {
                    }
                    else
                    {
                        _loc_8 = -1;
                        switch(_loc_7.type)
                        {
                            case ETaskProcess._ETaskProcessCollect:
                            {
                                _loc_8 = _loc_7.contents[0];
                                break;
                            }
                            case ETaskProcess._ETaskProcessDrop:
                            {
                                _loc_8 = _loc_7.contents[0];
                                break;
                            }
                            case ETaskProcess._ETaskProcessEscort:
                            {
                                _loc_8 = _loc_7.contents[0];
                                break;
                            }
                            case ETaskProcess._ETaskProcessKill:
                            {
                                _loc_8 = _loc_7.contents[0];
                                break;
                            }
                            default:
                            {
                                break;
                            }
                        }
                        if (_loc_8 != -1 && !this._bossNotSelect[_loc_8])
                        {
                            _loc_1[_loc_8] = true;
                        }
                    }
                    _loc_6++;
                }
            }
            return _loc_1;
        }// end function

    }
}
